{{define "infoCollection/physicalCheckup.html"}}
<div>
    <form class="form-horizontal" id="physicalCheckupForm">
        <div class="box-body">
            <div class="box box-info" style="box-shadow: none;margin-bottom: 0;">
                <div class="box-header with-border">
                    <h3 class="box-title">一般体征</h3>
                </div>
                <div style="padding-top: 10px;">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            检查时间：
                        </label>
                        <div class="col-sm-2">
                            <div class="input-group date">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>
                                <input type="text" name="tigejiancha_yibantizheng_checkDate" id="tigejiancha_yibantizheng_checkDate" class="form-control pull-right">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">
                            身高(cm)：
                        </label>
                        <div class="col-sm-2">
                            <input type="text" name="tigejiancha_height" id="tigejiancha_height" class="form-control" placeholder="身高">
                        </div>

                        <label class="col-sm-2 control-label">
                            体重(kg)：
                        </label>
                        <div class="col-sm-2">
                            <input type="text" name="tigejiancha_weight" id="tigejiancha_weight" class="form-control" placeholder="体重">
                        </div>

                        <label class="col-sm-2 control-label">
                            BMI(kg/m<sup>2</sup>)：
                        </label>
                        <div class="col-sm-1">
                            <input type="text" name="tigejiancha_bmi" id="tigejiancha_bmi" class="form-control" style="border-style:none;color:red;font-weight:bold">
                        </div>
                    </div>
                    <div class="form-group">
                    <label class="col-sm-2 control-label">
                        腰围(cm)：
                    </label>
                    <div class="col-sm-2">
                        <input type="text" name="tigejiancha_yaowei" id="tigejiancha_yaowei" class="form-control" placeholder="腰围">
                    </div>
                </div>
                </div>

                <div class="box box-info" style="box-shadow: none;margin-bottom: 0;">
                    <div class="box-header with-border">
                        <h3 class="box-title">血压(同侧，测量2次)</h3>
                    </div>
                    <div style="padding-top: 10px;">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                调查员：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_diaochayuan" id="tigejiancha_xueya_diaochayuan" class="form-control" placeholder="调查员">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                测量时间：
                            </label>
                            <div class="col-sm-2">
                                <div class="input-group date">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <input type="text" name="tigejiancha_xueya_measureDate" id="tigejiancha_xueya_measureDate" class="form-control pull-right">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                1、收缩压SBP(mmHg)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_firstSBP" id="tigejiancha_xueya_firstSBP" class="form-control" placeholder="收缩压">
                            </div>

                            <label class="col-sm-2 control-label">
                                舒张压DBP(mmHg)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_firstDSP" id="tigejiancha_xueya_firstDSP" class="form-control" placeholder="舒张压">
                            </div>

                            <label class="col-sm-2 control-label">
                                脉搏(次/分)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_firstPulseRate" id="tigejiancha_xueya_firstPulseRate" class="form-control" placeholder="脉搏">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                2、收缩压SBP(mmHg)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_secondSBP" id="tigejiancha_xueya_secondSBP" class="form-control" placeholder="收缩压">
                            </div>

                            <label class="col-sm-2 control-label">
                                舒张压DBP(mmHg)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_secondDSP" id="tigejiancha_xueya_secondDSP" class="form-control" placeholder="舒张压">
                            </div>

                            <label class="col-sm-2 control-label">
                                脉搏(次/分)：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xueya_secondPulseRate" id="tigejiancha_xueya_secondPulseRate" class="form-control" placeholder="脉搏">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="box box-info" style="box-shadow: none;margin-bottom: 0;">
                    <div class="box-header with-border">
                        <h3 class="box-title">心脏听诊</h3>
                    </div>
                    <div style="padding-top: 10px;">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                调查员：
                            </label>
                            <div class="col-sm-2">
                                <input type="text" name="tigejiancha_xinzang_diaochayuan" id="tigejiancha_xinzang_diaochayuan" class="form-control" placeholder="调查员">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                检查时间：
                            </label>
                            <div class="col-sm-2">
                                <div class="input-group date">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <input type="text" name="tigejiancha_xinzang_checkDate" id="tigejiancha_xinzang_checkDate" class="form-control pull-right">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">心脏杂音：</label>
                            <div class="radio col-sm-2">
                                <input type="radio" name="tigejiancha_xinzang_zayin" value="无" class="minimal" checked>&nbsp;&nbsp;无&nbsp;&nbsp;
                                <input type="radio" name="tigejiancha_xinzang_zayin" value="有" class="minimal">&nbsp;&nbsp;有
                            </div>
                            <label class="control-label col-sm-2">心率：</label>
                            <div class="radio col-sm-2">
                                <input type="radio" name="tigejiancha_xinzang_xinlv" value="整齐" class="minimal" checked>&nbsp;&nbsp;整齐&nbsp;&nbsp;
                                <input type="radio" name="tigejiancha_xinzang_xinlv" value="不齐" class="minimal">&nbsp;&nbsp;不齐
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <button type="button" class="btn btn-info btn-lg middleBtn" id="savePhysicalCheckup">保存</button>
        </div>
    </form>

</div>
<script>
    if (canUpdate != null && canUpdate != undefined && !canUpdate) {
        $("#savePhysicalCheckup").hide();
    }

    $("#tigejiancha_height,#tigejiancha_weight").change(function(){
        if($("#tigejiancha_height").val() && $("#tigejiancha_weight").val()){
            let bmi = $("#tigejiancha_weight").val()/Math.pow(($("#tigejiancha_height").val()/100),2);
            if(bmi){
                $("#tigejiancha_bmi").val(bmi.toFixed(1));
            }
        }
    });

    $("#savePhysicalCheckup").click(function () {
        let d = {};
        let t = $('#physicalCheckupForm').serializeArray();
        $.each(t, function () {
            d[this.name] = this.value;
        });
        let data = JSON.stringify(d);
        ajaxLoading("正在提交数据...");
        $.post("/infoCollection/save", {type: "physicalCheckup", id: $("#screenId").val(), data: data}, function (resp) {
            ajaxLoadEnd();
            afterUpdateFormData(resp,"physicalCheckup");

        });
    });

    function physicalCheckupInit(physicalCheckupData) {
        $("#physicalCheckupForm").initForm({jsonValue: physicalCheckupData, isDebug: false});
    }

</script>
{{end}}